
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<link href="style.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../static/js/jQuery/jquery.js"></script>
		<script type="text/javascript">
			$(function(){
				setReSize();
				$(window).resize(setReSize);
				$('#agreementPrev').click(function(){
					window.location.href = '?step=' + ( $(this).attr('rel') - 1 );
				});
			});
			function setReSize(){
				var _h = $(window).height();
				var _warp_h = $('#warp').height() + 82;
				var _height = ( _h - _warp_h ) / 2;
				$('#warp').css('margin-top',_height);
			}
		</script>
		<title>NDlog 安装向导 </title>
	</head>
	<body>
		<div id="warp">
						<form action='index.php?step=3' method="post">
			<div id="content">
				<h1 class="l1 nt">数据库配置</h1>
				<dl class="l1 nt">
					<dt>数据库服务器</dt>
					<dd>格式：地址(:端口)，一般为 localhost</dd>
					<dd><input type="text" name="db_host" value="localhost" size="40" class='input' /></dd>
				</dl>
				<dl class="l1 nt wrbg">
					<dt>数据库用户名</dt>
					<dd></dd>
					<dd><input type="text" name="db_username" value="root" size="40" class='input' /></dd>
				</dl>
				<dl class="l1 nt">
					<dt>数据库密码</dt>
					<dd></dd>
					<dd><input type="password" name="db_password" value="" size="40" class='input' /></dd>
				</dl>
				<dl class="l1 nt wrbg">
					<dt>数据库名</dt>
					<dd></dd>
					<dd><input type="text" name="db_name" value="ndlog" size="40" class='input' /></dd>
				</dl>
				<dl class="l1 nt">
					<dt>表名前缀</dt>
					<dd>同一数据库安装多个NDlog时可改变默认值</dd>
					<dd><input type="text" name="db_prefix" value="ndlog_" size="40" class='input' /></dd>
				</dl>
				<dl class="l1 nt wrbg">
					<dt>站点地址</dt>
					<dd>网站URL地址</dd>
					<dd><input type="text" name="site_url" value="http://localhost/MZQ" size="40" class='input' /></dd>
				</dl>
				
				<h1 class="l1 nt">超级管理员资料</h1>
				<dl class="l1 nt">
					<dt>用户的起始ID</dt>
					<dd></dd>
					<dd><input type="text" name="first_user_id" value="admin" size="40" class='input' /></dd>
				</dl>
				<dl class="l1 nt wrbg">
					<dt>电子邮件</dt>
					<dd></dd>
					<dd><input type="text" name="email" value="webmaster@206c.net" size="40" class='input' /></dd>
				</dl>
				<dl class="l1 nt">
					<dt>密码</dt>
					<dd>为确保您网站管理的安全，密码必须大于6位数，并且是字母+数字或者符号</dd>
					<dd><input type="password" name="password" value="" size="40" class='input' /></dd>
				</dl>
				<dl class="l1 nt wrbg">
					<dt>重复密码</dt>
					<dd></dd>
					<dd><input type="password" name="rpassword" value="" size="40" class='input' /></dd>
				</dl>
			</div>
			<div class="ch_next">
				<input type="button" id="agreementPrev" rel="2" value="上一步" class="submit" style="float:left;margin-top:15px;" />
				<input type="submit" id="agreementNext" value="下一步" class="submit" style="float:right;margin-top:15px;" />
			</div>
			</form>
			<script type="text/javascript">
				$(function(){
					//检测提交表单
					$('#agreementNext').click(function(){
						var db_host = $.trim( $('input[name="db_host"]').val() );
						var db_username = $.trim( $('input[name="db_username"]').val() );
						var db_password = $.trim( $('input[name="db_password"]').val() );
						var db_name = $.trim( $('input[name="db_name"]').val() );
						var db_prefix = $.trim( $('input[name="db_prefix"]').val() );
						//var site_url = $.trim( $('input[name="site_url"]').val() );
						
						var first_user_id = $.trim( $('input[name="first_user_id"]').val() );
						var password = $.trim( $('input[name="password"]').val() );
						var rpassword = $.trim( $('input[name="rpassword"]').val() );
						if ( db_host == '' ){
							alert('请填写数据库地址，一般本机为localhost');
							return false;
						}
						if ( db_username == '' ){
							alert('请填写数据库用户名！');
							return false;
						}
						/*if ( db_password == '' ){
							alert('请填写数据库密码！');
							return false;
						}*/
						if ( db_name == '' ){
							alert('请填写数据库名！');
							return false;
						}
						if ( db_prefix == '' ){
							alert('表前缀不可为空！');
							return false;
						}
						if ( first_user_id == '' ){
							alert('起始管理员账号必须填写！');
							return false;
						}
						if ( password == '' ){
							alert('请设置管理员密码！');
							return false;
						}
						if ( password != rpassword ){
							alert('两次输入的密码不同，情重新设置！');
							return false;
						}
					});
				});
			</script>
					</div>
	</body>
</html>